package com.smile.frame.api.demo.permissionKey;

import com.smile.frame.api.demo.base.permission.PermissionKeyInterface;
import com.smile.frame.api.demo.urls.DemoUrl;
import lombok.Getter;


/**
 * demo相关权限key
 *
 * @author LGC
 * @date 2021/10/13 14:09
 */
@Getter
public enum DemoPermissionKey implements PermissionKeyInterface {
    /**
     * demo
     */
    demo_test("demo_test", DemoUrl.TEST, true),
    ;

    /**
     * 权限key
     */
    private final String permission_key;
    /**
     * 请求url
     */
    private final String url;

    /**
     * 是否验权
     */
    private final Boolean is_authority;

    DemoPermissionKey(String permission_key, String url, Boolean is_authority) {
        this.permission_key = permission_key;
        this.url = url;
        this.is_authority = is_authority;
    }

    public static DemoPermissionKey getEnum(String permission_key) {
        for (DemoPermissionKey e : DemoPermissionKey.values()) {
            if (permission_key.equals(e.getPermission_key())) {
                return e;
            }
        }
        return null;
    }
}
